package com.qxkj.mysql.multidb.demo.controller;

import com.qxkj.mysql.multidb.demo.pojo.User;
import com.qxkj.mysql.multidb.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Copyright © 2018年 ziniuxiaozhu. All rights reserved.
 *
 * @Author 临江仙 hzqiuxm@163.com
 * TODO:亲爱的临江仙，请写点注释吧...........
 * @Date 2018/9/5 9:11
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping
    public List<User> get(@RequestBody User user){

        return userService.select(user);
    }

    @PostMapping
    public void add(){

        User user = new User();
        user.setAge(30);
        user.setPassword("123321");
        user.setUserName("hzqiuxm");
        user.setUserNum("13989461462");

        userService.insert(user);
    }

}
